﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Caching;

namespace Utilities
{
    public static class ExtensionCache
    {
        public static void me_CacheValue(this Cache cache, bool isCacheValid, string name, object obj, double hours)
        {
            if (isCacheValid)
            {
                cache.Insert(name, obj, null, DateTime.Now.AddHours(hours), TimeSpan.Zero);
            }
        }

        public static bool me_IsCacheValid(this Cache cache, string appSetting)
        {
            return ConfigurationManager.AppSettings[appSetting] == "true";
        }
    }
}
